package org.annoflow.audit;

import java.util.Date;

import org.annoflow.audit.Logger.LogLevel;
import org.annoflow.policy.PolicyType;

public class Data {
//	private String from;
	private Class<?> to;
	private String auditText;
	private LogLevel level;
	private PolicyType policySnapshot;
	private long timestamp;

	public Data(LogLevel level, Class<?> to, PolicyType policy,
			String auditText) {
		this.level = level;
//		this.from = from;
		this.to = to;
		this.policySnapshot = policy;
		this.auditText = auditText;
		this.timestamp = System.currentTimeMillis();
	}

//	public String getFrom() {
//		return from;
//	}

	public String getTo() {
		return to.getName();
	}

	public String getAuditText() {
		return auditText;
	}

	public LogLevel getLogLevel() {

		return level;
	}

	public String getLevel() {
		switch (level) {
		case OUT:
			return "Normal";
		case ERROR:
			return "Error";
		}
		return "";
	}

	public PolicyType getPolicySnapshot() {
		return policySnapshot;
	}
	public String getObjectPolicy()
	{
		if(policySnapshot != null)
		{
			return policySnapshot.getClass().getName();
		}
		return "";
	}
	public Date getTime()
	{
		return new Date(timestamp);
	}
}